import 'dart:convert';
import 'dart:developer';

import 'package:dio/dio.dart';
import 'package:flutter_base/model/article_model.dart';
import 'package:flutter_base/model/banner_data.dart';
import 'package:flutter_base/model/base_model.dart';
import 'dio_util.dart';

class ApiService {
  static const String BASE_URL = 'https://www.wanandroid.com';

  // Future getHomeBanner(Function callback) async {
  //   final Response response = await DioUtil().get('$BASE_URL/banner/json');
  //   callback(BannerData.fromJson(json.decode(response.data.toString()) as Map<String, dynamic>));
  // }

  Future getHomeArticleList(int pageNumber, Function callback) async {
    final BaseModel baseModel = await DioUtil().get('$BASE_URL/article/list/$pageNumber/json');
    callback(ArticleModel.fromJson(baseModel.data as Map<String, dynamic>));
  }
}
